<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml"> 
 
<head> 
	<meta http-equiv="Content-type" content="text/html; charset=utf-8" /> 
	<title>湖南省自来水公司营销管理信息系统</title> 
	
	<link rel="stylesheet" href="../css/reset.css" type="text/css" media="screen" title="no title" />
	<link rel="stylesheet" href="../css/text.css" type="text/css" media="screen" title="no title" />
	<link rel="stylesheet" href="../css/form.css" type="text/css" media="screen" title="no title" />
	<link rel="stylesheet" href="../css/buttons.css" type="text/css" media="screen" title="no title" />
	<link rel="stylesheet" href="../css/grid.css" type="text/css" media="screen" title="no title" />	
	<link rel="stylesheet" href="../css/layout.css" type="text/css" media="screen" title="no title" />	
	
	<link rel="stylesheet" href="../css/ui-darkness/jquery-ui-1.8.12.custom.css" type="text/css" media="screen" title="no title" />
	<link rel="stylesheet" href="../css/plugin/jquery.visualize.css" type="text/css" media="screen" title="no title" />
	<link rel="stylesheet" href="../css/plugin/facebox.css" type="text/css" media="screen" title="no title" />
	<link rel="stylesheet" href="../css/plugin/uniform.default.css" type="text/css" media="screen" title="no title" />
	<link rel="stylesheet" href="../css/plugin/dataTables.css" type="text/css" media="screen" title="no title" />
	
	<link rel="stylesheet" href="../css/custom.css" type="text/css" media="screen" title="no title">
     <script src="../js/vue.js"></script>
    <script src="../js/jquery/jquery-3.3.1.min.js"></script>
</head> 
<body>
<div id="wrapper">
<div id="bool"><script>window.onload=function (){  $("#bool").load("../ming.html");}</script></div>


	<div id="content" class="xgrid">
		
 		
		<div class="x12">
			
			<h2>添加/修改抄表辖区</h2>
			
			<div class="form label-inline uniform">
	
				<div class="field"><label for="id">抄表辖区ID</label><input id="sid" name="fname" size="50" type="text" v-if="SysArea.id==''" value="自动生成" class="medium" disabled="disabled"  /> <input id="id" v-model="SysArea.id" v-if="SysArea.id!=''" name="fname" size="50" type="text" class="medium" disabled="disabled"  /></div>
				
				<div class="field"><label for="name">抄表辖区名称</label> <input id="name" v-model="SysArea.AreaName" name="lname" size="50" type="text" class="medium" /></div>

							
				<div class="field"><label for="description">备注</label> <textarea rows="7" cols="50" v-model="SysArea.Remark" id="description" name="description"></textarea></div>

				<div class="buttonrow">
					<button class="btn" v-if="SysArea.id==''" @click="add()">保存</button>
                    <button class="btn" v-if="SysArea.id!=''" @click="update()">修改</button>
                    <button class="btn btn-grey" onClick="history.back(-1);">返回</button>
				</div>

			</div>
			
		</div> <!-- .x12 -->
		
	</div> <!-- #content -->
	
	<div id="footer">		
		<div class="content_pad">			
			<p>&copy; 2013-11 版权所有 <a href="#">湖南省自来水公司</a>.   技术支持 <a href="#">职业教育</a>.</p>
		</div> <!-- .content_pad -->
	</div> <!-- #footer -->
	
</div> <!-- #wrapper -->

<script src="../js/jquery/jquery-1.5.2.min.js"></script>
<script src="../js/jquery/jquery-ui-1.8.12.custom.min.js"></script>
<script src="../js/misc/excanvas.min.js"></script>
<script src="../js/jquery/facebox.js"></script>
<script src="../js/jquery/jquery.visualize.js"></script>
<script src="../js/jquery/jquery.dataTables.min.js"></script>
<script src="../js/jquery/jquery.tablesorter.min.js"></script>
<script src="../js/jquery/jquery.uniform.min.js"></script>
<script src="../js/jquery/jquery.placeholder.min.js"></script>

<script src="../js/widgets.js"></script>
<script src="../js/dashboard.js"></script>

<script type="text/javascript">
	
$(document).ready ( function ()
{
	Dashboard.init ();
});

var app = new Vue({
    el:"#wrapper",
    data:{
        SysArea:{
            AreaName:'',
            Disabled:'false',
            id:'',
            Remark:'',
        }
    },
    methods:{
           add(){
               $.getJSON("/SyArea/add",this.SysArea,function(json){
               if(json==1){
                  alert("添加成功");
                  location.href="sys_area.html";
               }
               });
           },
           update(){
                   $.getJSON("/SyArea/update",this.SysArea,function(json){
                       if(json==1){
                           alert("修改成功");
                           location.href="sys_area.html";
                       }
                   });
           }
    },
    created(){
        var u = new URLSearchParams(location.search);
        var id = u.get("id");
        if(id!=null){
           $.getJSON("/SyArea/queryByid/"+id,{},function(json){
               app.SysArea.id=json.id;
               app.SysArea.AreaName=json.areaName;
               app.SysArea.Remark=json.remark;
           });
        }
    }
});

</script>

</body> 
 
</html>